The Gin Rummy program can be run on any Macintosh computer. It needs 410K of memory and is 32-bit clean.
I am releasing this program as shareware for $10.
Gin Rummy is a card game for two people. A game consists of a series of hands, and it ends when a player accumulates 100 or more points. Then, the final scores are calculated and the player with the higher score is the winner.
I will assume that you know the rules of Gin Rummy. If not, you can read the section on Gin Rummy in almost any book on card games, which you can obtain from your local library or bookstore.
The product names mentioned in this document are the trademarks or registered trademarks of their manufacturers.
The following tells you how to use this program.
Start a game.
------------
When a new game starts, the computer will automatically cut the cards for each player to see who deals first. The player who cuts high must deal. Thereafter, the winner of each game deals the first hand of the next game. However, if you start a new game when the current game is not over, you will again cut for deal. You can start a new game or quit at any time by selecting the appropriate item from the game menu.
After the cards are cut, you should click the "deal first" button on the button bar at the bottom of the window or select the "deal new hand" item from the game menu. The first hand of the game will then be dealt.
Deal a hand.
-----------
When a new hand is dealt, the dealer gets ten cards and the non-dealer gets eleven cards. The non-dealer starts by playing one of his or her cards.
The winner of the hand deals the next hand.
Get a card.
----------
You can draw the top card of the face down stock pile or pick up the top card of the face up discard pile. Choose by clicking the top card of the appropriate pile or clicking the appropriate button on the button bar.
The card you select will be added to your hand at the far right and highlighted. However, if you click a pile and your mouse preference is "move as image," then you must move the card to your hand.
You cannot draw a card if the stock pile contains only two cards. You can pick up the last discard or click the "hand is dead" button, in which case it is a draw and neither player scores any points and the dealer redeals the hand.
Undo get card.
-------------
You can undo the card you drew by selecting the "undo draw card" item from the edit menu.
You can undo the card you picked up by moving it back to the discard pile. Or, you can select the "undo pick up discard" item from the edit menu.
Play a card.
-----------
You can discard, knock with a deadwood count of 10 or less, or gin if you have no deadwood count.
First, you must highlight exactly one card that you wish to discard. Then, move the card from your hand to the discard pile, pressing the option key if you wish to go out. Or, click the appropriate button on the button bar. Your discard will be placed face up on top of the discard pile. If you knocked or ginned, the hand ends and you must put down your melds. Otherwise, it's your opponent's turn to get and play a card.
As a shortcut for discarding, you can hold down the command key and click once on the card you wish to discard. The highlighting of the cards in your hand is ignored in this case, and the selected card is discarded.
Meld.
----
You can put down only one meld at a time. If your opponent knocked, you can also lay off cards from your hand that extend any meld of the opponent.
First, highlight the cards that you wish to meld or lay off. Then, move the meld or lay offs from your hand to the table area to the left of the cards in your hand. Or, click the "put down meld" or the "lay off cards" button on the button bar. Your meld or lay offs will be placed to the left, apart from the remaining cards in your hand.
Repeat this for the other melds in your hand. If you are moving cards, you must release them over the cards already on the table.
All laid off cards will be grouped together, placed last among all the melded cards.
Unmeld.
------
You can pick up one or more melds or all your lay offs from the table and put them back into your hand.
First, highlight what you want to pick up. Then, move them from the table to your hand. Or, click the "pick up meld" button on the button bar. The selected cards will be picked up from the table and placed back into your hand.
If you knocked or ginned, you can undo that choice by clicking the "cancel melding" button on the button bar. All your melds will be picked up from the table and your last discard will be returned back to your hand. This is useful if you discard the wrong card when you knock or gin.
Finished meld.
---------------
When you have nothing more to meld, click the "finished melding" button on the button bar at the bottom of the window.
Kibitzer.
--------
The kibitzer can give you advice when it is your turn to get a card, play a card, or meld. Just select the "kibitzer" item from the special menu or press its command key equivalent. The kibitzer will tell you his suggestion by using Macintalk or by highlighting the button to click or the card to discard, depending on which boxes you checked for the kibitzer option in the preference dialog.
If you want to use Macintalk, be sure to also check the "on" box for the Macintalk option in the preference dialog.
Computer opponent.
--------------------
You can set the skill level of the computer to "beginner" or "intermediate." The "expert" skill level is not done yet.
You can set the strategy of the computer to one of three choices. The first two strategies are pure strategies, and the third is based on some of the suggestions given by Walter B. Gibson in his book "Hoyle's Simplified Guide to the Popular Card Games."
When "computer versus computer" is selected from the game menu, the skill level and the strategy of the second player ("you") can be set differently than that of the first player ("me").
Start a selection.
-----------------
You have two ways to start a new selection. The cards you select will be highlighted and any previously highlighted cards will be unhighlighted.
In the first way, click just outside of the first card that you wish to select; drag straight into it; drag through adjacent cards to select more; finally, release the mouse button.
In the second way, click inside a card you wish to select. If your mouse preference is "click to select," drag through adjacent cards to select more, and finally release the mouse button. If your mouse preference is "click to move," the card that you clicked will be selected, and you can start moving it.
To select all cards, hold down the shift key and double click on any unhighlighted card.
Modify a selection.
------------------
You can modify your current selection by selecting a range of unhilighted cards to add or a range of highlighted cards to remove. Any previously selected cards outside of the range will remain highlighted.
To make a modification, hold down the shift key and click inside a card you wish to modify; drag through adjacent cards to modify more; finally, release the mouse button.
To unselect all cards, single click in the area that is just outside of your cards, or hold down the shift key and double click on any highlighted card.
Move cards.
----------
To move one or more cards in your hand, first select the cards you wish to move. Then, click on one of the highlighted cards, and start moving the cards to the new location. The "hot point" of your selection is always located at the lowest point of the arc at the upper left corner of your selection.
Move the "hot point" of your selection to the point where you want the cards to be moved, and release the cards. The selected cards will be sorted and moved to the new location.
As a shortcut, if you release the cards in the area that is just outside of your cards, the cards will be placed at the far left of your hand.
Release cards.
-------------
Your "move by" mouse preference determines how you release the cards that you move.
If you move by dragging, then release the mouse button where you want the cards to be released.
If you move by grabbing, you can release the mouse button at any time. You can still continue to move the cards. Then, click where you want the cards to be released.
Game variations.
---------------
You can select the Oklahoma variation from the preference dialog. This is the same as the normal variation of Gin Rummy, except for the following. After the cards are dealt, the bottom card of the stock pile is turned face up. This is the upturn card. If it is a spade, the score for that hand is doubled. Its rank determines the knock requirement. If it is a face card, your deadwood count must be 10 points or less to knock, as usual. If it is a pip card, your deadwood count must be less than the rank of the upturn card. In particular, if the upturn card is an ace, you must gin. It is recommended that you increase the points needed to end a game from 100 to 150 or 200.
Thanks.
------
I wish to thank Barry L. Wolman for his freeware program SerialPrint II. I used it to print my program listings on a twelve year old Epson FX printer (which my sister gave me). It is connected to my Mac via a 9-pin Grappler parallel printer interface cable from Orange Micro Inc.
Credits.
-------
I wish to give credit to the following people for code that they developed, which I used in my program.
Dmitri Linde and Peter Kaplan provided C code and assembly code to interface with Macintalk.
Scott Knaster described C code to do offscreen drawing in his book "Macintosh Programming Secrets."
Programming tools.
-----------------
I developed the Gin Rummy program on a 2Mb/40Mb LC, with an Apple 12" monochrome monitor. I used System 7. The following are the tools that I used to develop the program:
Think C 4.0 by Symantec.
ResEdit 2.1.1 by Apple.
MacsBug 6.2 by Apple.
SoftPaint (A paint program on Issue #26 of Diskworld, one of the monthly "magazine" disks by Softdisk Publishing).
Word 4.0 by Microsoft.
SuperGlue II by Solutions.
SerialPrint II by Barry L. Wolman.
References.
----------
1) Apple. "Inside Macintosh, Volume I."
2) Apple. "Inside Macintosh, Volume II."
3) Chernicoff, Stephen. "Macintosh Revealed, Volume One: Unlocking the Toolbox, Second Edition."
5) Knaster, Scott, and Rollin, Keith. "Macintosh Programming Secrets. Second Edition."
6) Little, Gary, and Swihart, Tim. "Programming for System 7."
7) Mark, Dave, and Reed, Cartwright. "Macintosh Programming Primer."
8) Mark, Dave. "Macintosh C Programming Primer, Volume II."
9) Matthies, Kurt W.G., and Hogan, Thom. "Macintosh C Programming by Example."
10) Mednieks, Zigurd R., and Schilke, Terry M. "C Programming Techniques for the Macintosh."
Version History.
---------------
Version 2.0 was released April 12, 1993. The following changes were made:
A) I added the following mouse preferences. You can move images of the cards instead of their outlines. You can grab cards instead of dragging them. You can click to move a card instead of clicking to select a card.
B) To change your preferences during the play, you click the "ok" button in the preference dialog. To retain your preferences after you have quit, you must click the "save" button .
C) You can modify the points for bonuses and the points needed to end a game. Requested by R. Iwanchuk.
D) You can keep a tally of the winner's victories and points. Requested by C. Metelli.
E) I added more undo cases. You can now undo "draw a card" and "pick up discard." Requested by C. Metelli and Hans Bosch.
F) I added the Oklahoma game variation. Based on a request by R. Iwanchuk.
G) I improved the computer's melding and laying off of cards when the opponent has knocked. The computer should now always get the least deadwood count in this case.
H) I used Think C's object-oriented programming. It is excellent.
Version 1.2 was released July 11, 1992. The following change was made:
A) I added an edit that you can't lay off cards on your opponent's melds after your opponent has ginned.
Version 1.1 was released June 30, 1992. The following changes were made:
A) Mike Muller pointed out that the bottom part of the screen containing the button bar was chopped off when run on a powerbook. I now display the smaller window if the height of the screen is less than 480 pixels or if the width is less than 640.
B) I added an edit that you can't finish melding after you knock if your deadwood count is more than 10. (I left out this edit in order to test my melding code without playing a full game, and I forgot to put it in later.)
C) I fixed the program so that you must click exactly on the top card of the stock pile or the discard pile in order to draw a card or pick up the discard card.
D) I now have the correct picture of the Gin Rummy icon appearing in the upper left corner of the dialog window that is displayed if you turn on macintalk in the preference dialog but you don't have macintalk in your system folder. (I deleted that picture when I was cleaning up the resource file using ResEdit. I thought it wasn't used for anything.)
E) I modified the change of cursors in different cases. For example, I now change to the arrow cursor when a dialog window becomes active. I think this prevents confusion if the clock cursor would continue to be displayed. For, you must click on your choice in the dialog window, and not wait for the computer to finish its processing.
F) In several cases, I failed to change to the correct cursor when I should have. This occurred when you released the mouse button after you had clicked in the menu bar or in a dialog. I fixed these problems. (I was depending on the mouseup event to detect when the mouse button was released: but the built-in tracking of the mouse movement in the menu bar or in a dialog intercepts the mouseup event.)
G) When you knocked with a deadwood count of more than ten points or ginned with a deadwood count not zero, and then select the "machine versus machine" item from the game menu, the computer would finish the melding even though the final deadwood count was improper. This has been fixed.
H) I made other changes which are hopefully transparent. For example, I'm using windows rather than dialogs, as recommended in the Macintosh Technical Note #203. (Even before I saw this tech note, I knew dialogs should not be used as main windows, but I wanted to try dialogs since the dialog manager does so much of the work for the programmer and ResEdit is so easy to use to set up the control items in a dialog, but not in a window. Now I'm using windows to see how the two compare.)
Version 1.0 was released May 12, 1992.
My programs.
-----------
The following are the programs I have released:
1) Achi, version 1.0, freeware.
Achi is a board game for two people, similar to
tic-tac-toe.
3) Bezique, version 1.0, freeware.
Bezique is a card game for two people.
3) Gin Rummy, version 2.0, shareware $10.
Gin Rummy is a card game for two people.
Your comments.
-------------
You can send your shareware fees, comments, program bugs that you find, and suggestions to me at this address:
William Hale
7117 Sycamore
New Orleans, La. 70118
Or e-mail to pc0tmys@music.tcs.tulane.edu, where the third character is a zero, not a letter.
Please mention the name and version of the program that you are writing about.
Shareware form.
--------------
Your name:
Your address:
Your city:
Your state:
Your zip:
Your country:
Please enclose $10 for Gin Rummy 2.0 and mail to:
William Hale
7117 Sycamore
New Orleans, La. 70118
Thank you for your support to help me enhance this program and release other programs like it!